True if this instance would overlap ANY instance of obj (solid or not, excluding itself) if it stood at (x, y). Name more objects after the first and it is true if it would overlap any of them.
pos_meeting(x, y, obj, ...more) -> bool| Name | Type |
|---|---|
x | real |
y | real |
obj | object |
...more | object (any number of them, none included) |
bool
True if this instance would overlap ANY instance of obj - solid or not, excluding itself - if it stood at (x, y). The same shape as pos_free, but testing against one specific object regardless of its own solid flag, rather than "is anything solid in the way at all."
x and y are a place in the room, counted from the room's top-left corner, the same way this instance's own x and y are counted.
If obj is a parent, its children count as obj too. With obj_enemy as the parent of obj_slime, pos_meeting(x, y, obj_enemy) is true when a slime is in the way. Overlap and collision lists everywhere a parent's name reaches its children.
You can name more than one object: pos_meeting(x, y, obj_sign, obj_door) is true when this instance would overlap an instance of any of them, each one counted together with its children.
That makes it the right check for a non-solid trigger - a pickup, a sign, a sensor object - that pos_free would walk straight through without ever noticing. An object whose Code-tab box Never moves is ticked is answered from a look-up grid instead - same answer, much less work when there are many copies (Never moves).
An instance destroyed earlier in the same frame still counts for this check until the end of the frame, because instance_destroy only ends it then. The one exception is a Collision event, which skips it at once.
An instance with no sprite and no mask size is a single point. A box meets that point only when the point is strictly inside it - past its left and top edges and short of its right and bottom edges. A point exactly on an edge or a corner is not met, and two boxes with no size never meet. (Overlap and collision has the whole rule.)
if (pos_meeting(x + hsp, y + vsp, obj_doc_target)) {
speed = 0;
}Stops the walker dead the instant its next step would touch any obj_doc_target instance, whether or not that instance is marked solid - pos_free would only have noticed a solid one.
Any number of objects may be named; each one is checked together with its children, and an object named twice is checked once. An instance with no sprite and no mask size is a single point at its x and y (moved by mask_x and mask_y). A box meets that point only when the point lies strictly inside it, past its left and top edges and short of its right and bottom edges; a point exactly on an edge or a corner is not met, and two boxes with no size never meet, even in the same spot. A box with a width and no height (or the reverse) is a line, met when it lies strictly between the edges of the other box across its empty side.